<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>卖家-修改个人信息</title>
<link href="<?php echo $this->_webroot('/user/css/common.css'); ?>" rel="stylesheet" type="text/css" />
<link href="<?php echo $this->_webroot('/user/css/content1.css'); ?>" rel="stylesheet" type="text/css" />
<script src="<?php echo $this->_webroot('/user/js/jquery-1.7.1.min.js'); ?>" type="text/javascript"></script>
<script src="<?php echo $this->_webroot('/user/js/common.js'); ?>" type="text/javascript"></script>


<script type="text/javascript" src="<?php echo $this->_webroot('servtools/jquery-1.3.2.min.js?v=1.3.2'); ?>"></script>
<script type="text/javascript" src="<?php echo $this->_webroot('servtools/xheditor/xheditor.min.js?v=1.0.0-final'); ?>"></script>
<script type="text/javascript">
var introeditor;
$(function(){
	introeditor=$("#shopintro").xheditor({skin:'vista',tools:"Cut,Copy,Paste,Pastetext,Separator,Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,SelectAll,Removeformat,Separator,Align,List,Outdent,Indent,Separator,Link,Unlink,Img,Table,Separator,Fullscreen,About"});

});
</script>


</head>
<!--
<body onload="initialize();">
-->
<body >
<psp:tags     htmlname='user_topnav1'  iconname='usertopnav1' />
<psp:tags     htmlname='user_topsearch'  iconname='usertopsearch' />

<div class="main">
	<div class="main-left">
    	<div class="title">会员管理中心</div>
        <psp:tags     htmlname='user_menulist'  iconname='usermenulist' />
    </div>
<link href="<?php echo $this->_webroot('/user/css/shoprequest.css'); ?>" rel="stylesheet" type="text/css" />   
    <div class="main-right main_right">
	

	
<div class="cont">
                <div class="cont_title">店铺设置</div>


				
				
				<form action="<?php echo $this->_url('user/shopinfo');?>" method="post" name="form_shop_info" onsubmit="return checkForm();" enctype="multipart/form-data">
				<table width="100%"  style="border:0;" cellspacing="0">
                    <!--
					<tr>
						<td class="textright" width="15%">二级域名:</td>
						<td><input type="text" name="shop_domain" value="<?php echo  $shop_info['shopinfo']['shop_domain'];?>" style="width:250px;" maxlength="50" /></td>
					</tr>
                    -->
					
					<tr>
					    <td class="textright" width="15%">店铺名称:</td>
						<td><input type="text" name="data[shopinfo][shop_name]" value="<?php echo  $shop_info['shopinfo']['shop_name'];?>" style="width:250px;" maxlength="50" />
							<span class="red">*</span></td>
					</tr>
					<tr><td class="textright" width="15%">店铺分类:</td>
						<td style="float:none;">
						
							<span id="shop_country">
								<select name="data[shopinfo][categories_parent]" onchange="categorieschanged(this.value)">
									<option value='0'>选择分类</option>
									<?php  foreach($shop_categories_parent as $v) {?>
										<option value="<?php echo  $v['shopcategories']['id'];?>"
											<?php  if($v['shopcategories']['id']==$categories_parent){echo 'selected';}?>><?php echo  $v['shopcategories']['cat_name'];?></option>
									<?php }?>
								</select>
							</span>
							<span id="shop_categories">
	
							</span>						
						<span class="red">*</span>
						</td>
					</tr>
					<tr>
						<td class="textright">所在地区:</td>
						<td style="float:none;">
								<span id="user_country">
								<select name="data[shopinfo][shop_country]" onchange="areachanged(this.value,0);">
									<option value='0'>选择国家</option>
								 <?php   foreach($areas_info[0] as $v){?>
									<option value="<?php echo  $v['id'];?>" <?php  if($v['id']==$shop_info[shopinfo]['shop_country']){echo 'selected';}?>><?php echo  $v['area_name'];?></option>
								<?php }?>
								</select>
								</span>
								
								<span id="user_province"><?php  if($shop_info[shopinfo]['shop_country']){?>
								<select name="data[shopinfo][shop_province]" onchange="areachanged(this.value,1);">
									<option value='0'>选择省份</option>
								<?php foreach($areas_info[1] as $v) {
										if($v['parent_id'] == $shop_info[shopinfo]['shop_country']){?>
									<option value="<?php echo  $v['id'];?>" <?php   if($v['id']==$shop_info['shopinfo']['shop_province']){echo 'selected';}?>><?php echo  $v['area_name'];?></option>
								<?php 	}
								}?>
								</select>
								<?php }?>
								</span>
								
								<span id="user_city">
								<?php 	 if($shop_info[shopinfo]['shop_province']){?>
								<select name="data[shopinfo][shop_city]" onchange="areachanged(this.value,2);">
									<option value='0'>选择城市</option>
								    <?php foreach($areas_info[2] as $v) {
										if($v['parent_id'] == $shop_info[shopinfo]['shop_province']){?>
									<option value="<?php echo  $v['id'];?>" <?php  if($v['id']==$shop_info[shopinfo]['shop_city']){echo 'selected';}?>><?php echo  $v['area_name'];?></option>
								<?php 	}
								}?></select>
								<?php }?>
								</span>
								
								<span id="user_district">
								<?php  if($shop_info[shopinfo]['shop_city']) {?>
								<select name="data[shopinfo][shop_district]"  onchange="areachanged(this.value,3);">
									<option value='0'>选择地区</option>
								<?php foreach($areas_info[3] as $v) {
										if($v['parent_id'] == $shop_info[shopinfo]['shop_city']){?>
									<option value="<?php echo  $v['id'];?>" <?php   if($v['id']==$shop_info[shopinfo]['shop_district']){echo 'selected';}?>><?php echo  $v['area_name'];?></option>
								<?php 	}
								}?>
								</select>
								<?php }?>
								</span>
								
								<span id="user_bcircle">
								<?php  if($shop_info[shopinfo]['shop_district']) { ?>
								<select name="data[shopinfo][shop_bcircle]">
									<option value='0'>选择地区</option>
								<?php foreach($areas_info[4] as $v) {
										if($v['parent_id'] == $shop_info[shopinfo]['shop_district']){?>
									<option value="<?php echo  $v['id'];?>" <?php   if($v['id']==$shop_info[shopinfo]['shop_bcircle']){echo 'selected';}?>><?php echo  $v['area_name'];?></option>
								<?php 	}
								}?>
								</select>
								<?php }?>
								</span>
								
						<span class="red">*</span></td>
					</tr>
					<tr>
						<td class="textright">经营范围:</td>
						<td><input type="text" name="data[shopinfo][shop_management]" value="<?php echo  $shop_info['shopinfo']['shop_management'];?>" style="width:250px;" maxlength="200" /> <span class="red">*</span> 
							

						</td>
					</tr>
					<tr>
					    <td class="textright" width="15%">店铺联系人:</td>
						<td><input type="text" name="data[shopinfo][person_name]" value="<?php echo  $shop_info['shopinfo']['person_name'];?>" style="width:250px;" maxlength="50" />
							<span class="red">*</span></td>
					</tr>
					
					<tr>
					    <td class="textright" width="15%">店铺电话:</td>
						<td><input type="text" name="data[shopinfo][telphone]" value="<?php echo  $shop_info['shopinfo']['telphone'];?>" style="width:250px;" maxlength="50" />
							<span class="red">*</span></td>
					</tr>
					<tr>
					    <td class="textright" width="15%">移动电话:</td>
						<td><input type="text" name="data[shopinfo][mobile]" value="<?php echo  $shop_info['shopinfo']['mobile'];?>" style="width:250px;" maxlength="50" />
							<span class="red">*</span></td>
					</tr>
					<tr>
					    <td class="textright" width="15%">邮编:</td>
						<td><input type="text" name="data[shopinfo][zipcode]" value="<?php echo  $shop_info['shopinfo']['zipcode'];?>" style="width:250px;" maxlength="50" />
							<span class="red">*</span></td>
					</tr>					
					<tr>
					    <td class="textright" width="15%">店铺传真:</td>
						<td><input type="text" name="data[shopinfo][fax]" value="<?php echo  $shop_info['shopinfo']['fax'];?>" style="width:250px;" maxlength="50" />
							<span class="red">*</span></td>
					</tr>	
					<tr>
					    <td class="textright" width="15%">公司网址:</td>
						<td><input type="text" name="data[shopinfo][compenyurl]" value="<?php echo  $shop_info['shopinfo']['compenyurl'];?>" style="width:250px;" maxlength="50" />
							<span class="red">*</span></td>
					</tr>	


					
					<tr>
					    <td class="textright" width="15%">店铺QQ号:</td>
						<td><input type="text" name="data[shopinfo][shopqq]" value="<?php echo  $shop_info['shopinfo']['shopqq'];?>" style="width:250px;" maxlength="50" />
							<span class="red">提示：有多个qq号时，qq号之间用逗号(,)隔开</span></td>
					</tr>					
					<tr><td class="textright">详细地址:</td>
						<td><input type="text" name="data[shopinfo][shop_address]" value="<?php echo  $shop_info['shopinfo']['shop_address'];?>" style="width:250px;" maxlength="200" /> <span class="red">*</span> 
						<!--&nbsp;【<a onclick="discontrol('map_canvas',this)" href="#">点击打开地图，设置我的位置</a>】
						<div id="map_canvas" style="width:550px; height:400px;"></div>
                        -->
						</td>
					</tr>	

<tr> 
      <td  class="textright">地图位置:</td>
      <td > 
      	<input type="text" onclick="window.open('<?php echo $this->_url('googlemap/googlemap/');?>?position=<?php echo $shop_info['shopinfo']['map_x'];?>,<?php echo $shop_info['shopinfo']['map_y'];?>&amp;mapid=mapid);" readonly="" value="<?php echo $shop_info['shopinfo']['map_x'];?>,<?php echo $shop_info['shopinfo']['map_y'];?>" size="40" id="mapid" name="company_maps" class="input_text">
        (<img src="<?php echo $this->_webroot('googlemaps/icon_qi.gif'); ?>"><a target="_blank" href="<?php echo $this->_url('googlemap/googlemap/');?>?position=<?php echo $shop_info['shopinfo']['map_x'];?>,<?php echo $shop_info['shopinfo']['map_y'];?>&amp;mapid=mapid">点击标注地图位置</a> 
<font color="#999999">标注后，公司地址将定位到电子地图上</font>) (<a href="javascript:;" onclick="document.getElementById('mapid').value='';">清除</a>)      </td>
    </tr>					

					<tr style="line-height:18px;"><td class="textright">店铺简介:</td>
						<td>
						<textarea name="data[shopinfo][shop_intro]" id="shopintro" cols="100" rows="10"><?php echo  $shop_info['shopinfo']['shop_intro'];?></textarea>
					</td></tr>
<?php
$shoptemplate_arr[] = array(
	'imgurl' => 'skin/default/images/default_small.gif',
	'bigimgurl' => 'skin/default/images/default.gif',
	'tpltag' => 'default',
	'tplname' => '默认模板'
);

?>		
					
					<tr><td class="textright">选择模板:</td><td class="templageimg">
					<?php  foreach($shoptemplate_arr as $v) {?>
						<span><img src="<?php echo  $v['imgurl'];?>" width="95" alt="<?php echo  $v['tplname'];?>" onclick="wshowimg('<?php echo  $v['bigimgurl'];?>')" onmouseover="imgmover(this)" onmouseout="imgmout(this)" onerror="this.src='<?php echo $this->_webroot('/user/images/nopic.gif'); ?>'"/><br /><input type="radio" name="data[shopinfo][shop_template]" value="<?php echo  $v['tpltag'];?>" <?php  if($shop_info['shopinfo']['shop_template']==$v['tpltag']) {?> checked<?php }?> /> <?php echo  $v['tplname'];?></span>
					<?php }?>
					</td></tr>

					<tr style="display:none;"><td class="textright">店铺简介图片:</td>
					<td>
                     <input type="file" name="doc[]" /> 
                   <?php  if($shop_info['shopinfo']['shop_images'])
					{ echo "<img src='".$shop_info['shopinfo']['shop_images']."' height='80' onerror=\"javascript:this.src='skin/default/images/no_page.jpg'\"/>";?><?php }?> 
					建议大小:200X200,不修改请留空！
					</td></tr>

					<tr><td class="textright" style="white-space:nowrap">店铺LOGO图片:</td>
					<td>
					<input type="file" name="doc1[]" /> <?php  if($shop_info['shopinfo']['shop_logo'])
					{ echo "<img src='".$shop_info['shopinfo']['shop_logo']."' height='80' onerror=\"javascript:this.src='skin/default/images/no_page.jpg'\"/>";?><?php }?>
					建议大小:200X100,不修改请留空！</td></tr>
					<tr><td class="textright" style="white-space:nowrap">店铺头上大图片:</td>
					<td><input type="file" name="doc2[]" /> <?php  if($shop_info['shopinfo']['shop_template_img'])
					{echo "<img src='".$shop_info['shopinfo']['shop_template_img']."' height='80' onerror=\"javascript:this.src='skin/default/images/no_page.jpg'\"/>";?><?php }?> 
					建议大小:960X150,不修改请留空！</td></tr>
					<tr><td></td><td>
					<input type="hidden" name="shop_id" value="<?php echo $shop_info['shopinfo']['id'];?>" />
					<input class="submit" type="submit" name="submit" value="修改店铺" /></td></tr>
					
					<input type="hidden" name="data[shopinfo][now_x]" id="now_x" value="<?php echo $shop_info['shopinfo']['now_x'];?>" />
					<input type="hidden" name="data[shopinfo][now_y]" id="now_y" value="<?php echo $shop_info['shopinfo']['now_y'];?>" />
					<input type="hidden" name="data[shopinfo][map_zoom]" id="now_zoom" value="<?php echo $shop_info['shopinfo']['map_zoom'];?>" />
				</table>
				</form>				
				


            </div>	
	
	

        

    </div>
    <div class="clear"></div>
</div>

<div class="footer">
    <psp:tags     htmlname='user_footer_helper'  iconname='userfooterhelper' />

</div>

<div id="showimg" style="display:none; width:408px; text-align:center; border:5px solid #F6A248; position:absolute; padding:4px; background:#fff; top:200px;"><img id="imgsrc" src="skin/default/images/shop_template_default_big.gif" width="400" /></div>
<div style="width:0px; height:0px; overflow:hidden;"><input type="input" id="hiddeninput" onblur="whideimg()" /></div>
<!--
<script src="http://maps.google.com/maps?file=api&v=2.x&key=ABQIAAAAPMb9i-xfXea2BhwglLD6vhQQfXL1E26uZVzpSr4bnBOO5ggYXxTJ8o5DOfAanEM5dHhSGnAhnn526Q" type="text/javascript"></script>
-->
<script language="JavaScript" src="<?php echo $this->_webroot('servtools/ajax_client/ajax.js');?>"></script>
<script language="JavaScript">
<!--

categorieschanged(<?php echo $categories_parent ?>,<?php echo $categories_child ?>);

function imgmover(obj) {
	obj.style.border = '2px solid #E38016';
}

function imgmout(obj) {
	obj.style.border = '2px solid #eee';
}

function wshowimg(v) {
	var width = document.body.clientWidth;
	var showimg = document.getElementById("showimg");
	var imgsrc = document.getElementById("imgsrc");

	var left = "100";
	if(width) {
		left = (width-400)/2;
	}
	showimg.style.left = left+"px";
	showimg.style.display = '';
	imgsrc.src = v;
	document.getElementById("hiddeninput").focus();
}

function whideimg() {
	var showimg = document.getElementById("showimg");
	showimg.style.display = 'none';
}

function areachanged(value,type){
	if(value > 0) {	
		ajax("<?php echo $this->_url('user/getareas');?>","POST","value="+value+"&mode=shopinfo&pre=shop_&type="+type,function(return_text){
			var return_text = return_text.replace(/[\n\r]/g,"");
			if(return_text==""){
				alert("请重新选择!！");
			} else {
				if(type==0) {
					document.getElementById("user_province").innerHTML = return_text;
					show("user_province");
					hide("user_city");
					hide("user_district");
					hide("user_bcircle");					
				} else if(type==1) {
					document.getElementById("user_city").innerHTML = return_text;
					show("user_city");
					hide("user_district");
					hide("user_bcircle");					
				} else if(type==2) {
					document.getElementById("user_district").innerHTML = return_text;
					show("user_district");
					hide("user_bcircle");					
				} else if(type==3) {
				
					document.getElementById("user_bcircle").innerHTML = return_text;
					show("user_bcircle");
				}	
			}
		});
	} else {
		if(type==3) {
			hide("user_bcircle");
		}else if(type==2) {
			hide("user_bcircle");		
			hide("user_district");
		} else if(type==1) {
			hide("user_bcircle");		
			hide("user_district");
			hide("user_city");
		} else if(type==0) {
			hide("user_bcircle");		
			hide("user_district");
			hide("user_city");
			hide("user_province");
		}
	}
}


function categorieschanged(value,child_value){
	if(value > 0) {
		ajax("<?php echo $this->_url('user/getshopcategories');?>","POST","mode=shopinfo&value="+value+"&child_value="+child_value,function(return_text){
			return_text = return_text.replace(/[\n\r]/g,"");
			document.getElementById("shop_categories").innerHTML = return_text;
			show("shop_categories");
		});
	}
}

function v_change(value,rank){
	if(value > 0) {
		ajax("do.php?act=shop_categories","POST","value="+value+"&rank="+rank,function(return_text){

			if (rank == '0'){
				document.getElementById("rank1").innerHTML = return_text;
				show("rank1");
				hide("rank2");
				hide("rank3");
				hide("rank4");

			}else if(rank == '1'){
				document.getElementById("rank2").innerHTML = return_text;

				show("rank2");
				hide("rank3");
				hide("rank4");
			}else if(rank == '2'){
				document.getElementById("rank3").innerHTML = return_text;

				show("rank3");
				hide("rank4");
			}else if(rank == '3'){
				document.getElementById("rank4").innerHTML = return_text;

				show("rank4");
			}

		});
	}else {
		if(rank == '3'){
			hide("rank4");
		}else if(rank == '2'){
			hide("rank3");
			hide("rank4");
		}else if(rank == '1'){
			hide("rank2");
			hide("rank3");
			hide("rank4");
		}else if(rank == '0'){
			hide("rank1");
			hide("rank2");
			hide("rank3");
			hide("rank4");
		}
	}
}


function hide(id) {
	document.getElementById(id).style.display = 'none';
}
function show(id) {
	document.getElementById(id).style.display = '';
}

function checkForm() {
	var shop_domain = document.getElementsByName("shop_domain")[0];
	var shop_name = document.getElementsByName("shop_name")[0];
	var shop_address = document.getElementsByName("shop_address")[0];
	var shop_management = document.getElementsByName("shop_management")[0];
	var re=/^(\w){3,10}$/;
	if(!re.test(shop_domain.value)){
		alert("域名格式不正确!");
		shop_domain.focus();
		return false;
	}else if(shop_domain.value=='www') {
		alert("域名格式不正确!");
		shop_domain.focus();
		return false;
	}else if(shop_name.value=='') {
		alert("店铺名称不能为空！");
		shop_name.focus();
		return false;
	}else if(document.getElementsByName("categories_parent")[0].value==0) {
		alert("请选择分类！");
		return false;
	} 
	else if(document.getElementsByName("country")[0].value==0) {
		alert("请选择国家！");
		return false;
	} else if(document.getElementsByName("province")[0].value==0) {
		alert("请选择省份！");
		return false;
	} else if(document.getElementsByName("city")[0].value==0) {
		alert("请选择城市！");
		return false;
	} else if(document.getElementsByName("district")[0].value==0) {
		alert("请选择地区！");
		return false;
	} else if(shop_address.value=='') {
		alert("详细地址不能为空！");
		shop_name.focus();
		return false;
	} else if(shop_management.value=='') {
		alert("主要经营范围不能为空！");
		shop_management.focus();
		return false;
	}
	return true;
}



// 地图处理开始
/*
var now_x = <?php echo $shop_info['shopinfo']['map_x'];?>;
var now_y = <?php echo $shop_info['shopinfo']['map_y'];?>;
var now_zoom = <?php echo $shop_info['shopinfo']['map_zoom'];?>;

if(now_x=='0' && now_y=='0'){
	var now_x = '116.39328002929687';
	var now_y = '39.89709437260048';
	var now_zoom = '5';
}

function initialize() {
	if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("map_canvas"));
		var center = new GLatLng(now_y, now_x);
		map.setCenter(center, now_zoom);

		var point = new GLatLng(now_y,now_x);
		var marker = new GMarker(point);
		map.addOverlay(marker);

		GEvent.addListener(map,"click", function(overlay,latlng) {
			if(latlng) {
				var point = new GLatLng(latlng.y,latlng.x); // 根据经纬度创建点
				var marker = new GMarker(point);			// 创建标注
				map.clearOverlays();						// 清除现有地图上的所有标注
				map.addOverlay(marker);						// 添加新标注

				now_x = latlng.x;
				now_y = latlng.y;
				now_zoom = map.getZoom();

				document.getElementById('now_x').value=now_x;
				document.getElementById('now_y').value=now_y;
				document.getElementById('now_zoom').value=now_zoom;
			}
		});

		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
	}
	document.getElementById("map_canvas").style.display = "none";
}

function discontrol(itemid,obj)
{
	if(document.getElementById(itemid).style.display=='') {
		obj.innerHTML = '点击打开地图，设置我的位置';
		document.getElementById(itemid).style.display="none";
	} else {
		obj.innerHTML = '点击关闭地图，设置完毕';
 		document.getElementById(itemid).style.display="";
	}
}
// 地图处理结束
*/
//-->
</script>
</body>
</html>